package com.chinatsp.bean;

import java.util.List;

/**
 * HttpResponse 返回方法
 * Created by chenzhengdong on 2017/3/29.
 */
public class ResponseUtil {

    public static Response success() {
        Response result = new Response();
        result.setResp_status("OK");
        return result;
    }

    public static ResponseObject success(Object object) {
        ResponseObject result = new ResponseObject();
        result.setResp_status("OK");
        result.setResp_data(object);
        return result;
    }

    public static ResponseList success(List<?> list) {
        ResponseList result = new ResponseList();
        result.setResp_status("OK");
        if(list.size() <= 0 || list == null){
            success(new String());
        }else{
            result.setResp_data(list);
        }
        return result;
    }

    public static ResultErr error(String code, String msg) {
        ResultErr result = new ResultErr();
        result.setResp_status("ERR");
        result.setError_code(code);
        result.setError_desc(msg);
        return result;
    }

}
